package com.anorak.betsy.util;

import java.net.URLEncoder;

/**
 * @author anorak
 */
public class SearchUtil {

    public static String searchName(String name) {
        String text = URLEncoder.encode(name);
        text = text.replaceAll("\\+", "%20")
                .replaceAll("%28", "(")
                .replaceAll("%29", ")")
                .replaceAll("%27", "'")
                .replaceAll("%21", "!")
                .replaceAll("%7E", "~");
        text = text.replaceAll("_", "%5f")
                .replaceAll("-", "%2d")
                .replaceAll("\\.", "%2e")
                .replaceAll("~", "%7e")
                .replaceAll("!", "%21")
                .replaceAll("\\*", "%2a")
                .replaceAll("\\(", "%28")
                .replaceAll("\\)", "%29")
                .replaceAll("%", "_");
        return text;
    }

}
